import java.awt.Font;

import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;


public class JTableMemoriaControle extends JTable {
	public DefaultTableModel tableModel;
	private MemoriaControle memoriaControle;
	
	public JTableMemoriaControle(MemoriaControle memoriaControle)
	{
		this.memoriaControle = memoriaControle;
		tableModel= new DefaultTableModel()
		{
			public boolean isCellEditable(int row, int column) {
				return false;
			}
		};

		setModel(tableModel);
		tableModel.addColumn("end");
		tableModel.addColumn("valor");
		
		for(int i=0 ; i<memoriaControle.tam ; i++)
		{
			adicionarLinha(i, memoriaControle.getPos(i));
		}

		this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
	}

	public void adicionarLinha(int a, String b)
	{
		tableModel.addRow(new Object[] {a, b});
	}
	
}
